{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 准备工作"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-36-5b88dd831f9a>:17: DeprecationWarning: use options instead of chrome_options\n",
      "  driver = webdriver.Chrome( chrome_options = opts) #desired_capabilities=caps\n"
     ]
    }
   ],
   "source": [
    "from selenium import webdriver\n",
    "from selenium.webdriver.common.desired_capabilities import DesiredCapabilities\n",
    "\n",
    "\n",
    "#caps=dict()\n",
    "#caps[\"pageLoadStrategy\"] = \"none\"   # Do not wait for full page load\n",
    "\n",
    "opts = webdriver.ChromeOptions()\n",
    "opts.add_argument('--no-sandbox')#解决DevToolsActivePort文件不存在的报错\n",
    "opts.add_argument('window-size=1920x3000') #指定浏览器分辨率\n",
    "opts.add_argument('--disable-gpu') #谷歌文档提到需要加上一这个属性来规避bug\n",
    "opts.add_argument('--hide-scrollbars') #隐藏滚动条, 应对些特殊页面\n",
    "#opts.add_argument('blink-settings=imagesEnabled=false') #不加载图片, 提升速度\n",
    "#opts.add_argument('--headless') #浏览器不提供可视化页面. linux下如果系统不支持可视化不加这条会启动失败\n",
    "# opts.binary_location = \"C:\\portable\\PortableApps\\IronPortable\\App\\Iron\\chrome.exe\"\n",
    "# opts.binary_location = \"C:\\Program Files\\Google\\Chrome\\Application\\chromedriver.exe\" #\"H:\\_coding_\\Gitee\\InternetNewMedia\\CapstonePrj2016\\chromedriver.exe\"  \n",
    "driver = webdriver.Chrome( chrome_options = opts) #desired_capabilities=caps"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 打开CNKI\n",
    "1.校园网，自动登录\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "#打开知网\n",
    "driver.get(\"https://cnki.net\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'中山大学南...'"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#检查是否中山大学南方学院登录\n",
    "driver.find_element_by_id('Ecp_loginShowName1').get_attribute('innerHTML')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 点击高级检索\n",
    "element = driver.find_element_by_id('highSearch')\n",
    "element.get_attribute(\"innerHTML\")\n",
    "element.click()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 检查窗口"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'CDwindow-D099067984994C494E3A0C79D928D89A'"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "driver.current_window_handle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['CDwindow-D099067984994C494E3A0C79D928D89A',\n",
       " 'CDwindow-0CE55E689D4379C67490A5CDF1139785']"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "driver.window_handles"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-42-2c997ac77236>:2: DeprecationWarning: use driver.switch_to.window instead\n",
      "  driver.switch_to_window(driver.window_handles[1])\n"
     ]
    }
   ],
   "source": [
    "#切换窗口\n",
    "driver.switch_to_window(driver.window_handles[1])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 点击学术期刊、专业检索、选择期刊来源"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 点击学术期刊\n",
    "element = driver.find_element_by_xpath('//ul[@class=\"doctype-menus keji\"]//li[@data-id=\"xsqk\"]/a')\n",
    "element.get_attribute(\"innerHTML\")\n",
    "element.click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 点击专业检索\n",
    "element = driver.find_element_by_name('majorSearch')\n",
    "element.get_attribute(\"innerHTML\")\n",
    "element.click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 选择期刊来源\n",
    "element = driver.find_element_by_xpath('//div[@class=\"extend-tit-labels\"]//input[@key = \"EI\"]').click()\n",
    "element = driver.find_element_by_xpath('//div[@class=\"extend-tit-labels\"]//input[@key = \"CSI\"]').click()\n",
    "element = driver.find_element_by_xpath('//div[@class=\"extend-tit-labels\"]//input[@key = \"HX\"]').click()\n",
    "element = driver.find_element_by_xpath('//div[@class=\"extend-tit-labels\"]//input[@key = \"SI\"]').click()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 设置搜索query"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 设置query\n",
    "element = driver.find_element_by_xpath('/html/body/div[2]/div/div[2]/div/div[1]/div[1]/div[2]/textarea').send_keys('SU = \"新媒体\" AND SU=“网络”')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 点击搜索\n",
    "element = driver.find_element_by_xpath('/html/body/div[2]/div/div[2]/div/div[1]/div[1]/div[2]/div[2]/input').click()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 设置指定的下载路径"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os, sys\n",
    "ir_name = 'D:\\\\下载cnki文件\\\\'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前工作目录为 D:\\下载cnki文件\n"
     ]
    }
   ],
   "source": [
    "# 查看当前工作目录\n",
    "retval = os.getcwd()\n",
    "print(\"当前工作目录为 %s\" % retval)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 修改当前工作目录\n",
    "os.chdir( ir_name )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "目录修改成功 D:\\下载cnki文件\n"
     ]
    }
   ],
   "source": [
    "# 查看修改后的工作目录\n",
    "retval = os.getcwd()\n",
    "print( \"目录修改成功 %s\" % retval)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 改为每页50篇"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'1,391'"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 文章的总数量\n",
    "element = driver.find_element_by_xpath('//*[@id=\"countPageDiv\"]/span[1]/em')\n",
    "element.get_attribute('innerHTML')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 设置为每页50篇\n",
    "element = driver.find_element_by_xpath('//i[@class=\"icon icon-sort\"]').click()\n",
    "element = driver.find_element_by_xpath('//div[@id=\"perPageDiv\"]//li[@data-val=\"50\"]/a').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'1/28'"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看设置后一共多少页\n",
    "element = driver.find_element_by_xpath('//span[@class=\"countPageMark\"]')\n",
    "element.get_attribute('innerHTML')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 爬取页面的信息"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Unnamed: 0</th>\n",
       "      <th>论文篇名</th>\n",
       "      <th>作者</th>\n",
       "      <th>刊名</th>\n",
       "      <th>发表时间</th>\n",
       "      <th>被引</th>\n",
       "      <th>下载</th>\n",
       "      <th>操作</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>网络信息化下大学生思政教育创新路径选择与策略研究——评《新媒体时代下的高校思想政治教育研究》</td>\n",
       "      <td>刘文洁</td>\n",
       "      <td>人民长江</td>\n",
       "      <td>2021-06-28</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>加强新时代高校网络思想政治教育探究</td>\n",
       "      <td>高歌</td>\n",
       "      <td>学校党建与思想教育</td>\n",
       "      <td>2021-06-23</td>\n",
       "      <td>NaN</td>\n",
       "      <td>324.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>新媒体时代高校网络舆情引导机制探析</td>\n",
       "      <td>孙璐</td>\n",
       "      <td>新闻爱好者</td>\n",
       "      <td>2021-06-20</td>\n",
       "      <td>NaN</td>\n",
       "      <td>120.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>新媒体环境下网络广告创意设计研究——评《新媒体时代下的网络广告设计应用》</td>\n",
       "      <td>赵静静</td>\n",
       "      <td>新闻爱好者</td>\n",
       "      <td>2021-06-20</td>\n",
       "      <td>NaN</td>\n",
       "      <td>58.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>企业营销竞争力与消费者选择：社交网络营销的作用机理</td>\n",
       "      <td>周美</td>\n",
       "      <td>商业经济研究</td>\n",
       "      <td>2021-06-03</td>\n",
       "      <td>NaN</td>\n",
       "      <td>302.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>新媒体对高校思政教育的积极影响研究——评《高校网络思政教育平台的构建及其应用研究》</td>\n",
       "      <td>唐海玲</td>\n",
       "      <td>中国测试</td>\n",
       "      <td>2021-05-31</td>\n",
       "      <td>NaN</td>\n",
       "      <td>74.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7</td>\n",
       "      <td>“转发”行为的扩散与新媒体赋权——基于微博自闭症议题的社会网络分析</td>\n",
       "      <td>黄月琴; 黄宪成</td>\n",
       "      <td>新闻记者</td>\n",
       "      <td>2021-05-20</td>\n",
       "      <td>NaN</td>\n",
       "      <td>782.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8</td>\n",
       "      <td>新媒体视角下农产品网络营销策略创新研究</td>\n",
       "      <td>曹洁</td>\n",
       "      <td>农业经济</td>\n",
       "      <td>2021-05-15</td>\n",
       "      <td>NaN</td>\n",
       "      <td>887.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>9</td>\n",
       "      <td>嬗变、冲突与重构：新媒体视域下的网络舆论</td>\n",
       "      <td>陈晓伟; 董烁</td>\n",
       "      <td>中国编辑</td>\n",
       "      <td>2021-05-10</td>\n",
       "      <td>NaN</td>\n",
       "      <td>412.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>10</td>\n",
       "      <td>互联网背景下大学公共英语教学效率提升研究——评《网络与新媒体专业英语教程》</td>\n",
       "      <td>赵鹏</td>\n",
       "      <td>中国广播电视学刊</td>\n",
       "      <td>2021-05-01</td>\n",
       "      <td>NaN</td>\n",
       "      <td>49.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>11</td>\n",
       "      <td>广播电视和网络视听产业基地高质量发展策略研究</td>\n",
       "      <td>祝歆; 王森; 宋丽萍</td>\n",
       "      <td>中国广播电视学刊</td>\n",
       "      <td>2021-05-01</td>\n",
       "      <td>NaN</td>\n",
       "      <td>94.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>12</td>\n",
       "      <td>新媒体时代图书网络营销矩阵建设实务研究</td>\n",
       "      <td>郑丽珠</td>\n",
       "      <td>出版广角</td>\n",
       "      <td>2021-04-30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>136.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>13</td>\n",
       "      <td>网络时代传统媒体记者思维与角色的转换</td>\n",
       "      <td>初敏</td>\n",
       "      <td>青年记者</td>\n",
       "      <td>2021-04-30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>66.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>14</td>\n",
       "      <td>嵌入基层治理：县级融媒体中心与基层网络政务服务的融合发展</td>\n",
       "      <td>谢新洲; 石林</td>\n",
       "      <td>传媒</td>\n",
       "      <td>2021-04-25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>280.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>15</td>\n",
       "      <td>长城新媒体集团融合创新春晚形态——“河北网络春节云联欢”云端放异彩</td>\n",
       "      <td>李建; 田少华; 李遥</td>\n",
       "      <td>传媒</td>\n",
       "      <td>2021-04-25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>35.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>16</td>\n",
       "      <td>新媒体视域下赣南脐橙网络营销策略优化研究</td>\n",
       "      <td>唐剑鸿</td>\n",
       "      <td>食品研究与开发</td>\n",
       "      <td>2021-04-20</td>\n",
       "      <td>NaN</td>\n",
       "      <td>360.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>17</td>\n",
       "      <td>网络新媒体背景下铸造专业学术思政教育面临的挑战及对策</td>\n",
       "      <td>陈艳丽</td>\n",
       "      <td>特种铸造及有色合金</td>\n",
       "      <td>2021-04-20</td>\n",
       "      <td>NaN</td>\n",
       "      <td>60.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>18</td>\n",
       "      <td>网络问答社区科普质量评价研究——以“知乎”为例</td>\n",
       "      <td>周一杨</td>\n",
       "      <td>青年记者</td>\n",
       "      <td>2021-03-30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>99.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>19</td>\n",
       "      <td>网络社交媒体情感动员的成因及策略</td>\n",
       "      <td>宋亮</td>\n",
       "      <td>青年记者</td>\n",
       "      <td>2021-03-30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>127.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>20</td>\n",
       "      <td>网络时代红色资源在高校思政课中的应用</td>\n",
       "      <td>范小青</td>\n",
       "      <td>学校党建与思想教育</td>\n",
       "      <td>2021-03-23</td>\n",
       "      <td>NaN</td>\n",
       "      <td>554.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>21</td>\n",
       "      <td>现状与特征:社会网络分析在我国传播学研究中的应用</td>\n",
       "      <td>瞿旭晟; 赵鹏程</td>\n",
       "      <td>新闻爱好者</td>\n",
       "      <td>2021-03-20</td>\n",
       "      <td>NaN</td>\n",
       "      <td>439.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>22</td>\n",
       "      <td>从娱乐至死到网络至死:新媒体发展与城市生活状态</td>\n",
       "      <td>廖媌婧; 曾庆江</td>\n",
       "      <td>新闻爱好者</td>\n",
       "      <td>2021-03-20</td>\n",
       "      <td>NaN</td>\n",
       "      <td>336.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>23</td>\n",
       "      <td>信息化时代我国网络政治生态治理研究</td>\n",
       "      <td>许开轶</td>\n",
       "      <td>理论学刊</td>\n",
       "      <td>2021-03-15</td>\n",
       "      <td>NaN</td>\n",
       "      <td>129.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>24</td>\n",
       "      <td>出圈与折叠：2020年网络热点事件的舆论特征及对内容生产的意义</td>\n",
       "      <td>周葆华</td>\n",
       "      <td>新闻界</td>\n",
       "      <td>2021-03-08 13:06</td>\n",
       "      <td>3.0</td>\n",
       "      <td>889.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>25</td>\n",
       "      <td>关于高校网络意识形态安全建设的新考量</td>\n",
       "      <td>潘红涛</td>\n",
       "      <td>学校党建与思想教育</td>\n",
       "      <td>2021-03-08</td>\n",
       "      <td>2.0</td>\n",
       "      <td>433.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>26</td>\n",
       "      <td>提升高校社会主义核心价值观网络传播效果研究</td>\n",
       "      <td>高蕾; 魏楚元; 王洋</td>\n",
       "      <td>传媒</td>\n",
       "      <td>2021-02-25</td>\n",
       "      <td>1.0</td>\n",
       "      <td>136.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>27</td>\n",
       "      <td>网络时代民族团结教育研究——铸牢中华民族共同体意识研究系列论文之一</td>\n",
       "      <td>王卓</td>\n",
       "      <td>广西民族研究</td>\n",
       "      <td>2021-02-20</td>\n",
       "      <td>NaN</td>\n",
       "      <td>215.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>28</td>\n",
       "      <td>新媒体技术在英语教学与管理中的应用——评《基于网络多媒体的当代英语教学新探》</td>\n",
       "      <td>舒伟; 王若语</td>\n",
       "      <td>中国科技论文</td>\n",
       "      <td>2021-02-15</td>\n",
       "      <td>NaN</td>\n",
       "      <td>76.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>29</td>\n",
       "      <td>浅析广播电视新闻评论在网络媒体中的新常态运用</td>\n",
       "      <td>李节; 钟强</td>\n",
       "      <td>当代电视</td>\n",
       "      <td>2021-02-01</td>\n",
       "      <td>NaN</td>\n",
       "      <td>128.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>30</td>\n",
       "      <td>基于网络结构与内容分布的新媒体事件聚类研究</td>\n",
       "      <td>马昊; 马晓悦</td>\n",
       "      <td>现代情报</td>\n",
       "      <td>2021-02-01</td>\n",
       "      <td>NaN</td>\n",
       "      <td>165.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>31</td>\n",
       "      <td>社会网络及其在新媒体环境下对青少年吸烟行为的影响研究</td>\n",
       "      <td>戴珞佳; 谭银亮; 朱静芬</td>\n",
       "      <td>现代预防医学</td>\n",
       "      <td>2021-01-25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>185.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>32</td>\n",
       "      <td>新媒体时代公众参与网络信息治理的实现路径</td>\n",
       "      <td>魏小雨</td>\n",
       "      <td>新闻爱好者</td>\n",
       "      <td>2021-01-20</td>\n",
       "      <td>NaN</td>\n",
       "      <td>132.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>33</td>\n",
       "      <td>提升高校网络育人成效的路径研究</td>\n",
       "      <td>丰硕</td>\n",
       "      <td>学校党建与思想教育</td>\n",
       "      <td>2021-01-18</td>\n",
       "      <td>NaN</td>\n",
       "      <td>509.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>34</td>\n",
       "      <td>媒介素养研究核心议题:基于CSSCI期刊关键词网络分析</td>\n",
       "      <td>罗雁飞</td>\n",
       "      <td>中国出版</td>\n",
       "      <td>2021-01-16</td>\n",
       "      <td>NaN</td>\n",
       "      <td>576.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>35</td>\n",
       "      <td>2020年网络新媒体传播:重大现实主题与学科研究进展</td>\n",
       "      <td>孟威</td>\n",
       "      <td>当代传播</td>\n",
       "      <td>2021-01-15</td>\n",
       "      <td>NaN</td>\n",
       "      <td>511.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>36</td>\n",
       "      <td>社会责任将成网络平台的生命线</td>\n",
       "      <td>陈永东</td>\n",
       "      <td>青年记者</td>\n",
       "      <td>2021-01-15</td>\n",
       "      <td>NaN</td>\n",
       "      <td>166.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>37</td>\n",
       "      <td>网络青年亚文化的特征及引领路径探析</td>\n",
       "      <td>谌韵灵; 邹升平</td>\n",
       "      <td>南通大学学报(社会科学版)</td>\n",
       "      <td>2021-01-15</td>\n",
       "      <td>1.0</td>\n",
       "      <td>978.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>38</td>\n",
       "      <td>新媒体传播视野下民间艺术的突围——二人转艺术元素网络直播认知</td>\n",
       "      <td>刘帅</td>\n",
       "      <td>戏剧文学</td>\n",
       "      <td>2021-01-15</td>\n",
       "      <td>NaN</td>\n",
       "      <td>114.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>39</td>\n",
       "      <td>网络的法律地位:行政确认与《民法典》法律界定</td>\n",
       "      <td>陆小华</td>\n",
       "      <td>山西大学学报(哲学社会科学版)</td>\n",
       "      <td>2021-01-15</td>\n",
       "      <td>2.0</td>\n",
       "      <td>175.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>40</td>\n",
       "      <td>多媒体环境下社会主义核心价值观融入高校校园文化建设——评《新媒体时代议程设置嵌入高校网络思想...</td>\n",
       "      <td>刘静</td>\n",
       "      <td>中国科技论文</td>\n",
       "      <td>2021-01-15</td>\n",
       "      <td>NaN</td>\n",
       "      <td>229.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>41</td>\n",
       "      <td>构建网络内容治理主体协同机制的作用与优化路径</td>\n",
       "      <td>谢新洲; 宋琢</td>\n",
       "      <td>新闻与写作</td>\n",
       "      <td>2021-01-05</td>\n",
       "      <td>1.0</td>\n",
       "      <td>413.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>42</td>\n",
       "      <td>网络新媒体舆论的问题呈现和公共决策研究——评《网络新媒体舆论与公共决策——两个系统的互动研究》</td>\n",
       "      <td>马晓霞</td>\n",
       "      <td>中国广播电视学刊</td>\n",
       "      <td>2021-01-01</td>\n",
       "      <td>NaN</td>\n",
       "      <td>58.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>43</td>\n",
       "      <td>介入·引入·打入——传统主流媒体时评引导、平衡网络舆论探析</td>\n",
       "      <td>范金刚</td>\n",
       "      <td>青年记者</td>\n",
       "      <td>2020-12-30</td>\n",
       "      <td>1.0</td>\n",
       "      <td>171.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>44</td>\n",
       "      <td>高校教育网络环境对大学生心理健康维护的影响研究——评《网络环境下大学生心理健康教育研究》</td>\n",
       "      <td>贺天庆</td>\n",
       "      <td>中国学校卫生</td>\n",
       "      <td>2020-12-25</td>\n",
       "      <td>1.0</td>\n",
       "      <td>243.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>45</td>\n",
       "      <td>网络综艺脱口秀的青年亚文化叙事</td>\n",
       "      <td>肖雪菁</td>\n",
       "      <td>青年记者</td>\n",
       "      <td>2020-12-20</td>\n",
       "      <td>2.0</td>\n",
       "      <td>490.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>46</td>\n",
       "      <td>互联网背景下网络和新媒体技术对文学发展的影响研究</td>\n",
       "      <td>潘裕仙</td>\n",
       "      <td>食品研究与开发</td>\n",
       "      <td>2020-12-20</td>\n",
       "      <td>1.0</td>\n",
       "      <td>185.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>47</td>\n",
       "      <td>大学生网络思想政治教育的范式演进与经验启示</td>\n",
       "      <td>梁钦; 蒲清平; 肖国芳</td>\n",
       "      <td>思想政治教育研究</td>\n",
       "      <td>2020-12-20</td>\n",
       "      <td>3.0</td>\n",
       "      <td>808.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>48</td>\n",
       "      <td>基于舆论引导的网络新闻传播规划——评《新闻传播学热点专题:知识图谱》</td>\n",
       "      <td>柳太江</td>\n",
       "      <td>中国油脂</td>\n",
       "      <td>2020-12-16</td>\n",
       "      <td>1.0</td>\n",
       "      <td>241.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>49</td>\n",
       "      <td>新媒体产业资本流通与价值转移的影响机制研究——以网络视听行业为例</td>\n",
       "      <td>王建磊</td>\n",
       "      <td>新闻大学</td>\n",
       "      <td>2020-12-15</td>\n",
       "      <td>NaN</td>\n",
       "      <td>483.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>50</td>\n",
       "      <td>新文科背景下“网络与新媒体”专业人才培养</td>\n",
       "      <td>张宏邦</td>\n",
       "      <td>青年记者</td>\n",
       "      <td>2020-12-10</td>\n",
       "      <td>3.0</td>\n",
       "      <td>521.0</td>\n",
       "      <td>下载</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    Unnamed: 0                                                 篇名  \\\n",
       "0            1     网络信息化下大学生思政教育创新路径选择与策略研究——评《新媒体时代下的高校思想政治教育研究》   \n",
       "1            2                                  加强新时代高校网络思想政治教育探究   \n",
       "2            3                                  新媒体时代高校网络舆情引导机制探析   \n",
       "3            4               新媒体环境下网络广告创意设计研究——评《新媒体时代下的网络广告设计应用》   \n",
       "4            5                          企业营销竞争力与消费者选择：社交网络营销的作用机理   \n",
       "5            6          新媒体对高校思政教育的积极影响研究——评《高校网络思政教育平台的构建及其应用研究》   \n",
       "6            7                  “转发”行为的扩散与新媒体赋权——基于微博自闭症议题的社会网络分析   \n",
       "7            8                                新媒体视角下农产品网络营销策略创新研究   \n",
       "8            9                               嬗变、冲突与重构：新媒体视域下的网络舆论   \n",
       "9           10              互联网背景下大学公共英语教学效率提升研究——评《网络与新媒体专业英语教程》   \n",
       "10          11                             广播电视和网络视听产业基地高质量发展策略研究   \n",
       "11          12                                新媒体时代图书网络营销矩阵建设实务研究   \n",
       "12          13                                 网络时代传统媒体记者思维与角色的转换   \n",
       "13          14                       嵌入基层治理：县级融媒体中心与基层网络政务服务的融合发展   \n",
       "14          15                  长城新媒体集团融合创新春晚形态——“河北网络春节云联欢”云端放异彩   \n",
       "15          16                               新媒体视域下赣南脐橙网络营销策略优化研究   \n",
       "16          17                         网络新媒体背景下铸造专业学术思政教育面临的挑战及对策   \n",
       "17          18                            网络问答社区科普质量评价研究——以“知乎”为例   \n",
       "18          19                                   网络社交媒体情感动员的成因及策略   \n",
       "19          20                                 网络时代红色资源在高校思政课中的应用   \n",
       "20          21                           现状与特征:社会网络分析在我国传播学研究中的应用   \n",
       "21          22                            从娱乐至死到网络至死:新媒体发展与城市生活状态   \n",
       "22          23                                  信息化时代我国网络政治生态治理研究   \n",
       "23          24                    出圈与折叠：2020年网络热点事件的舆论特征及对内容生产的意义   \n",
       "24          25                                 关于高校网络意识形态安全建设的新考量   \n",
       "25          26                              提升高校社会主义核心价值观网络传播效果研究   \n",
       "26          27                  网络时代民族团结教育研究——铸牢中华民族共同体意识研究系列论文之一   \n",
       "27          28             新媒体技术在英语教学与管理中的应用——评《基于网络多媒体的当代英语教学新探》   \n",
       "28          29                             浅析广播电视新闻评论在网络媒体中的新常态运用   \n",
       "29          30                              基于网络结构与内容分布的新媒体事件聚类研究   \n",
       "30          31                         社会网络及其在新媒体环境下对青少年吸烟行为的影响研究   \n",
       "31          32                               新媒体时代公众参与网络信息治理的实现路径   \n",
       "32          33                                    提升高校网络育人成效的路径研究   \n",
       "33          34                        媒介素养研究核心议题:基于CSSCI期刊关键词网络分析   \n",
       "34          35                         2020年网络新媒体传播:重大现实主题与学科研究进展   \n",
       "35          36                                     社会责任将成网络平台的生命线   \n",
       "36          37                                  网络青年亚文化的特征及引领路径探析   \n",
       "37          38                     新媒体传播视野下民间艺术的突围——二人转艺术元素网络直播认知   \n",
       "38          39                             网络的法律地位:行政确认与《民法典》法律界定   \n",
       "39          40  多媒体环境下社会主义核心价值观融入高校校园文化建设——评《新媒体时代议程设置嵌入高校网络思想...   \n",
       "40          41                             构建网络内容治理主体协同机制的作用与优化路径   \n",
       "41          42    网络新媒体舆论的问题呈现和公共决策研究——评《网络新媒体舆论与公共决策——两个系统的互动研究》   \n",
       "42          43                      介入·引入·打入——传统主流媒体时评引导、平衡网络舆论探析   \n",
       "43          44       高校教育网络环境对大学生心理健康维护的影响研究——评《网络环境下大学生心理健康教育研究》   \n",
       "44          45                                    网络综艺脱口秀的青年亚文化叙事   \n",
       "45          46                           互联网背景下网络和新媒体技术对文学发展的影响研究   \n",
       "46          47                              大学生网络思想政治教育的范式演进与经验启示   \n",
       "47          48                 基于舆论引导的网络新闻传播规划——评《新闻传播学热点专题:知识图谱》   \n",
       "48          49                   新媒体产业资本流通与价值转移的影响机制研究——以网络视听行业为例   \n",
       "49          50                               新文科背景下“网络与新媒体”专业人才培养   \n",
       "\n",
       "               作者               刊名              发表时间   被引     下载  操作  \n",
       "0             刘文洁             人民长江        2021-06-28  NaN    NaN  下载  \n",
       "1              高歌        学校党建与思想教育        2021-06-23  NaN  324.0  下载  \n",
       "2              孙璐            新闻爱好者        2021-06-20  NaN  120.0  下载  \n",
       "3             赵静静            新闻爱好者        2021-06-20  NaN   58.0  下载  \n",
       "4              周美           商业经济研究        2021-06-03  NaN  302.0  下载  \n",
       "5             唐海玲             中国测试        2021-05-31  NaN   74.0  下载  \n",
       "6        黄月琴; 黄宪成             新闻记者        2021-05-20  NaN  782.0  下载  \n",
       "7              曹洁             农业经济        2021-05-15  NaN  887.0  下载  \n",
       "8         陈晓伟; 董烁             中国编辑        2021-05-10  NaN  412.0  下载  \n",
       "9              赵鹏         中国广播电视学刊        2021-05-01  NaN   49.0  下载  \n",
       "10    祝歆; 王森; 宋丽萍         中国广播电视学刊        2021-05-01  NaN   94.0  下载  \n",
       "11            郑丽珠             出版广角        2021-04-30  NaN  136.0  下载  \n",
       "12             初敏             青年记者        2021-04-30  NaN   66.0  下载  \n",
       "13        谢新洲; 石林               传媒        2021-04-25  NaN  280.0  下载  \n",
       "14    李建; 田少华; 李遥               传媒        2021-04-25  NaN   35.0  下载  \n",
       "15            唐剑鸿          食品研究与开发        2021-04-20  NaN  360.0  下载  \n",
       "16            陈艳丽        特种铸造及有色合金        2021-04-20  NaN   60.0  下载  \n",
       "17            周一杨             青年记者        2021-03-30  NaN   99.0  下载  \n",
       "18             宋亮             青年记者        2021-03-30  NaN  127.0  下载  \n",
       "19            范小青        学校党建与思想教育        2021-03-23  NaN  554.0  下载  \n",
       "20       瞿旭晟; 赵鹏程            新闻爱好者        2021-03-20  NaN  439.0  下载  \n",
       "21       廖媌婧; 曾庆江            新闻爱好者        2021-03-20  NaN  336.0  下载  \n",
       "22            许开轶             理论学刊        2021-03-15  NaN  129.0  下载  \n",
       "23            周葆华              新闻界  2021-03-08 13:06  3.0  889.0  下载  \n",
       "24            潘红涛        学校党建与思想教育        2021-03-08  2.0  433.0  下载  \n",
       "25    高蕾; 魏楚元; 王洋               传媒        2021-02-25  1.0  136.0  下载  \n",
       "26             王卓           广西民族研究        2021-02-20  NaN  215.0  下载  \n",
       "27        舒伟; 王若语           中国科技论文        2021-02-15  NaN   76.0  下载  \n",
       "28         李节; 钟强             当代电视        2021-02-01  NaN  128.0  下载  \n",
       "29        马昊; 马晓悦             现代情报        2021-02-01  NaN  165.0  下载  \n",
       "30  戴珞佳; 谭银亮; 朱静芬           现代预防医学        2021-01-25  NaN  185.0  下载  \n",
       "31            魏小雨            新闻爱好者        2021-01-20  NaN  132.0  下载  \n",
       "32             丰硕        学校党建与思想教育        2021-01-18  NaN  509.0  下载  \n",
       "33            罗雁飞             中国出版        2021-01-16  NaN  576.0  下载  \n",
       "34             孟威             当代传播        2021-01-15  NaN  511.0  下载  \n",
       "35            陈永东             青年记者        2021-01-15  NaN  166.0  下载  \n",
       "36       谌韵灵; 邹升平    南通大学学报(社会科学版)        2021-01-15  1.0  978.0  下载  \n",
       "37             刘帅             戏剧文学        2021-01-15  NaN  114.0  下载  \n",
       "38            陆小华  山西大学学报(哲学社会科学版)        2021-01-15  2.0  175.0  下载  \n",
       "39             刘静           中国科技论文        2021-01-15  NaN  229.0  下载  \n",
       "40        谢新洲; 宋琢            新闻与写作        2021-01-05  1.0  413.0  下载  \n",
       "41            马晓霞         中国广播电视学刊        2021-01-01  NaN   58.0  下载  \n",
       "42            范金刚             青年记者        2020-12-30  1.0  171.0  下载  \n",
       "43            贺天庆           中国学校卫生        2020-12-25  1.0  243.0  下载  \n",
       "44            肖雪菁             青年记者        2020-12-20  2.0  490.0  下载  \n",
       "45            潘裕仙          食品研究与开发        2020-12-20  1.0  185.0  下载  \n",
       "46   梁钦; 蒲清平; 肖国芳         思想政治教育研究        2020-12-20  3.0  808.0  下载  \n",
       "47            柳太江             中国油脂        2020-12-16  1.0  241.0  下载  \n",
       "48            王建磊             新闻大学        2020-12-15  NaN  483.0  下载  \n",
       "49            张宏邦             青年记者        2020-12-10  3.0  521.0  下载  "
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "element = driver.find_element_by_xpath('//div[@id=\"gridTable\"]')\n",
    "网页内容 = element.get_attribute('innerHTML')\n",
    "df=pd.read_html(网页内容)[0]\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 存到本地\n",
    "with pd.ExcelWriter('cnki数据挖掘pdf.xlsx',mode='w',engine=\"openpyxl\") as writer:  \n",
    "            data.to_excel(writer,sheet_name=\"cnki数据挖掘pdf\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 下载refworks文件及原文"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [],
   "source": [
    "from random import random"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n"
     ]
    }
   ],
   "source": [
    "# 每次全选不能超过500篇，分2次进行\n",
    "pages = list(range(1,11))\n",
    "print(pages)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 返回第一页\n",
    "driver.find_element_by_id('total').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 清除选中\n",
    "driver.find_element_by_xpath('//*[@id=\"gridTable\"]/div[1]/div[2]/div[1]/a').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 选中页面50篇 —> 翻页\n",
    "def process_choose(pages):\n",
    "    for p in pages:\n",
    "        print (p,end='\\t')\n",
    "        全选 = driver.find_element_by_id('selectCheckAll1')\n",
    "        全选.click()\n",
    "        time.sleep(20*random())\n",
    "        跳转 = driver.find_element_by_id('PageNext')\n",
    "        跳转.click()\n",
    "        time.sleep(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t"
     ]
    }
   ],
   "source": [
    "process_choose(pages)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 导出与分析 \n",
    "driver.find_element_by_xpath('//i[@class=\"icon-d\"]').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 导出文献\n",
    "driver.find_element_by_xpath('//i[@class=\"icon-r\"]').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 点击Refworks\n",
    "driver.find_element_by_xpath('//a[@exporttype=\"Refworks\"]').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['CDwindow-D099067984994C494E3A0C79D928D89A',\n",
       " 'CDwindow-0CE55E689D4379C67490A5CDF1139785',\n",
       " 'CDwindow-B642544AC4ED4FBC1EE7C1E0B27CBA4F']"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 所有窗口ID\n",
    "driver.window_handles"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-78-520070efe65b>:2: DeprecationWarning: use driver.switch_to.window instead\n",
      "  driver.switch_to_window(driver.window_handles[2])\n"
     ]
    }
   ],
   "source": [
    "# 窗口切换\n",
    "driver.switch_to_window(driver.window_handles[2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 导出 .txt文件\n",
    "driver.find_element_by_xpath('//i[@class=\"icon icon-export\"]').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-80-0188c2a7ff70>:2: DeprecationWarning: use driver.switch_to.window instead\n",
      "  driver.switch_to_window(driver.window_handles[1])\n"
     ]
    }
   ],
   "source": [
    "# 窗口切换\n",
    "driver.switch_to_window(driver.window_handles[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 清除选择\n",
    "driver.find_element_by_xpath('//*[@id=\"gridTable\"]/div[1]/div[2]/div[1]/a').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[10, 11, 12, 13, 14, 15]\n"
     ]
    }
   ],
   "source": [
    "# 第二轮下载\n",
    "pages = list(range(10,16))\n",
    "print(pages)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10\t11\t12\t13\t14\t15\t"
     ]
    }
   ],
   "source": [
    "process_choose(pages)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 导出与分析 \n",
    "driver.find_element_by_xpath('//i[@class=\"icon-d\"]').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 导出文献\n",
    "driver.find_element_by_xpath('//i[@class=\"icon-r\"]').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 点击Refworks\n",
    "driver.find_element_by_xpath('//a[@exporttype=\"Refworks\"]').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['CDwindow-D099067984994C494E3A0C79D928D89A',\n",
       " 'CDwindow-0CE55E689D4379C67490A5CDF1139785',\n",
       " 'CDwindow-B642544AC4ED4FBC1EE7C1E0B27CBA4F',\n",
       " 'CDwindow-332F28D7F028DEF0AFB22357CE717E10']"
      ]
     },
     "execution_count": 87,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 所有窗口ID\n",
    "driver.window_handles"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-88-1f3bb34cc9cb>:2: DeprecationWarning: use driver.switch_to.window instead\n",
      "  driver.switch_to_window(driver.window_handles[3])\n"
     ]
    }
   ],
   "source": [
    "# 窗口切换\n",
    "driver.switch_to_window(driver.window_handles[3])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 导出 .txt文件\n",
    "driver.find_element_by_xpath('//i[@class=\"icon icon-export\"]').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-90-0188c2a7ff70>:2: DeprecationWarning: use driver.switch_to.window instead\n",
      "  driver.switch_to_window(driver.window_handles[1])\n"
     ]
    }
   ],
   "source": [
    "# 窗口切换\n",
    "driver.switch_to_window(driver.window_handles[1])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 出现验证码时"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(code_ele.size)def pdf_down():\n",
    "    click_list = driver.find_elements_by_xpath('//table[@class=\"result-table-list\"]//a[@class=\"fz14\"]')  \n",
    "    for i in click_list:\n",
    "        i.click()\n",
    "        driver.switch_to_window(driver.window_handles[2])\n",
    "        element = driver.find_element_by_xpath('//*[@id=\"pdfDown\"]')\n",
    "        driver.execute_script(\"arguments[0].click();\", element)\n",
    "        time.sleep(5)\n",
    "        driver.close()\n",
    "        driver.switch_to_window(driver.window_handles[1])\n",
    "        \n",
    "    driver.find_element_by_id('PageNext').click()\n",
    "    time.sleep(5)\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'x': 678, 'y': 279}\n"
     ]
    }
   ],
   "source": [
    "##截图\n",
    "driver.save_screenshot(r\"C:\\Users\\18864\\Desktop\\img\\cnki.png\")\n",
    "#2.定位到验证码图片元素\n",
    "code_ele=driver.find_element_by_xpath('//*[@id=\"vImg\"]')\n",
    "print(code_ele.location)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'height': 50, 'width': 180}\n"
     ]
    }
   ],
   "source": [
    "print(code_ele.size)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "metadata": {},
   "outputs": [],
   "source": [
    "#5得到将元素的具体位置\n",
    "x0 = code_ele.location[\"x\"]\n",
    "s1 = x0*1.25\n",
    "y0 = code_ele.location[\"y\"]\n",
    "m1 = y0*1.25\n",
    "x1 = code_ele.size[\"width\"]+ x0\n",
    "s2 = x1*1.25\n",
    "y1 = code_ele.size[\"height\"]+ y0\n",
    "m2 = y1*1.25\n",
    "img = Image.open(open(r\"C:\\Users\\18864img = Image.open(open(r\"C:\\Users\\11519\\Desktop\\img\\seconned.png\",'r+b'))\n",
    "img \\Desktop\\img\\测试.png\",'r+b'))\n",
    "image=img.crop((s1,m1,s2,m2))#具体定位\n",
    "image.save(r\"C:\\Users\\11519\\Desktop\\img\\seconned.png\")#将验证码那一块图片保存"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAOAAAAA+CAYAAAAyGRe+AABLDElEQVR4nOW92bMsyX3f9/llZm3dffZzl9kxCwYAiYWkSErmYjrscIRDDw7ZftGTIxxh/3cOhxyS5ZBlhRS2oIWCRIrEkBhggMEMZu5+z366u6oy8+eHzKquc+65swB3IEY4gZ7bp6u6K7ff9v0tKVFVATS/ACS/hvfjhWnTa+8VUIXlGqoCX1q8USJKhSIoXX4pFhDOz0+Z24K9ZouoyglKFEElPd0AFUDocWJwxpK6q/m6YERQVbq+wziHMQYQAkokEjRiMBixCFBcG98v3RSIQMjvZfIyoJJecfKVyeUb51Ql/VwY71VUI0TFisGIIMjVxbrehoGpphekjhpNvy+wBjyRgMcQmWuBW/UIBjEOrEGdsARWIrRARGjUsOfB9vlnjYIoxBYlgHWIc3mEQhAh5jmY7i0HWEBV8UERI4gRYoz44ClcgYiM39Hxf3C5uqTzPdtbuwCs+hViDIV1WJSKAqNyZT6H6RrmXnTo4bWLuYNRnqWFX3m/PKe54UkCyC/7lOn3qhKsIWikC4kMCgzWCFYEhxA0svI9dVVjxbKMHo/QG0MA1l2HxsBeVROIFMZg0rYFYLVaUZYlxrq8LFC4AkTQqHgN+BBwRYHFIggxBNpuzVbVYI3hK2mTlRro85nLzyGcxL+Ui+UlxjnKosAag2AwRjHjD09/4DMWTPJ/NG///D0RweYbLDYxJwxSFGnHYtJGUKEQGcegQDn0f8pJjIC1+Q+I3uODUlQVgmzu5+aNLEYYeIqI4Ky7Miuq6SUCbdfy6OFDlusVW9/YQlWxRlKnNI5M9vo0XJ/yz9vmIw/7nPteRHNyE4seHi6bf8emm7V9polAYYmimetJ4qoIooLVdIsHghjUGjyGNbAk0mP4xdEDzk5O2LEV+2+8maRcJqDOe0LwPHr4kMODQ9xigTEmbd4Yk/ST9Cxj0vdUh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8S26rkspQije91SumODukyeLbuLOJv387Hb9+tVRbhJ3btZNY4wJG34OkqbX/r3evthSD26goVjhhk8M56hsmJFMmIjkMVy54/8X7boUDD5gh8yZTGAHBwejZjWYP7+sGvrCCdDlFMaU4Jr9XTGVbkvVnM2V45jhxSzwkAV/sL9P36ccu8I6fPCQ9XQfPMVYheMawQ0IxfTvL9TkSv9vkhRjPdIs9UT0yqOGezTqJi6T56hGk8+mpH2T6i6Z8K6qVdPfnF4bnjJIzlGRveEJL6Z9ATPtV29Tk//LPCt/z7rEqULY2IBFUYzEB3+D/IAiMmT4TraQXFm/FGhsx6ube3+F5+b/OmvZ3dkF0iEeLldSG9ThGIbCp0NnbtrWX/SJzyqIz1MZB39jQlnTd688+tqXrtgwNzw6ThRjHwKqMR3XBimEiiEjJYdkPfcoXflCI/5l7fLPaoMtnAISUjn9IQtG82fOunR0wGf0Z/rZM2P5HB3+89hKknqpePPzonGelxr1RdsL8wNO9Wi4gSs/ZzM95+MX0pdnfvfL7rbPfcozcuTL/9ykT3qNKJ8hwjxfIQdZK7Bar+h9z85iO2kd3qdKZpJt3l86f/bzE1t/lTYAXuu+wzmXyk6GwLpNNW+KoqCuKopcx/WXev7n6O+/mnr/YtoLk4BDp5+rCX8GF3rR7csY4r/aU6bS/lf4mS/+8TOt855117HNALYMJRwVDflkpL/BjjszCcgQI6N659zN0u9Ltc8Z9t+EWfn/AMIQ7/qd44lFAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<PIL.PngImagePlugin.PngImageFile image mode=RGBA size=224x62 at 0x25EF8927148>"
      ]
     },
     "execution_count": 112,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "img = Image.open(open(r\"C:\\Users\\11519\\Desktop\\img\\seconned.png\",'r+b'))\n",
    "img "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "import time\n",
    "import hashlib\n",
    "import base64\n",
    "import json\n",
    "#from urllib import parse\n",
    "# 印刷文字识别 webapi 接口地址\n",
    "URL = \"http://webapi.xfyun.cn/v1/service/v1/ocr/general\"\n",
    "# 应用ID (必须为webapi类型应用，并印刷文字识别服务，参考帖子如何创建一个webapi应用：http://bbs.xfyun.cn/forum.php?mod=viewthread&tid=36481)\n",
    "APPID = \"c5455422\"\n",
    "# 接口密钥(webapi类型应用开通印刷文字识别服务后，控制台--我的应用---印刷文字识别---服务的apikey)\n",
    "API_KEY = \"7792cfb21778802571fe9a47cc6650be\"\n",
    "def getHeader():\n",
    "#  当前时间戳\n",
    "    curTime = str(int(time.time()))\n",
    "#  支持语言类型和是否开启位置定位(默认否)\n",
    "    param = {\"language\": \"cn|en\", \"location\": \"false\"}\n",
    "    param = json.dumps(param)\n",
    "    paramBase64 = base64.b64encode(param.encode('utf-8'))\n",
    "\n",
    "    m2 = hashlib.md5()\n",
    "    str1 = API_KEY + curTime + str(paramBase64,'utf-8')\n",
    "    m2.update(str1.encode('utf-8'))\n",
    "    checkSum = m2.hexdigest()\n",
    "# 组装http请求头\n",
    "    header = {\n",
    "        'X-CurTime': curTime,\n",
    "        'X-Param': paramBase64,\n",
    "        'X-Appid': APPID,\n",
    "        'X-CheckSum': checkSum,\n",
    "        'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',\n",
    "    }\n",
    "    return header\n",
    "# 上传文件并进行base64位编码\n",
    "with open(r'C:\\Users\\11519\\Desktop\\img\\seconned.png', 'rb') as f:\n",
    "    f1 = f.read()\n",
    "\n",
    "f1_base64 = str(base64.b64encode(f1), 'utf-8')\n",
    "\n",
    "    \n",
    "data = {\n",
    "        'image': f1_base64\n",
    "        }\n",
    "\n",
    "\n",
    "r = requests.post(URL, data=data, headers=getHeader())\n",
    "result = str(r.content, 'utf-8')\n",
    "# 错误码链接：https://www.xfyun.cn/document/error-code (code返回错误码时必看)\n",
    "print(result)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'W5HW'"
      ]
     },
     "execution_count": 114,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    " import json\n",
    "user_dict = json.loads(result)\n",
    "user_dict[\"data\"][\"block\"][0][\"line\"][0]['word'][0]['content']\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 结束"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
